/*
	Written By Pradipna Nepal
	www.pradsprojects.com

	Copyright (C) 2012 Prads Projects
	Please read COPYING.txt included along with this source code for more detail.
	If not included, see http://www.gnu.org/licenses/
*/

#include "libHash.h"

//Returns 32 bits FNV hash
unsigned int Hash::fnvHash(const char *str, int size) {
	const int PRIME = 16777619;
	unsigned int retVal = 2166136261;

	while (size > 0) {
		retVal ^= str[--size];
		retVal *= PRIME;
	}

	return retVal;
}